//
//  UILabel+Extension.swift
//  微博项目
//
//  Created by zhaoyinpeng on 16/3/14.
//  Copyright © 2016年 zhaoyinpeng. All rights reserved.
//

import UIKit


extension UILabel {
    
    //.类工厂    类方法
    
    class func labelWith(textcolor: UIColor, fontSize: CGFloat, text: String,alignment: NSTextAlignment = .Center) -> UILabel {
        let l = UILabel()
        
        l.text = text
        l.textColor = textcolor
        l.font = UIFont.systemFontOfSize(fontSize)
        
        //.设置自动换行
        l.numberOfLines = 0
        //.设置居中
        l.textAlignment = alignment

        l.sizeToFit()
        
        return l
    }
}
